﻿#include "MyExport.h"

#include <iostream>
#include <string>

int add(int arg, int (*func)(int)) {
  return func(arg);
}

int theStr(const char *arg) {
  std::string str{arg};
  std::cout << str << std::endl;
  return str.size();
}

char **theStrArr(char **arg, int size) {
  for (int i = 0; i < size; ++i) {
    std::cout << "cur " << i << " is:" << arg[i] << std::endl;
  }
  return arg;
}

void returnStr(const char *arg, char* buffer, int bufferSize) {
  std::string str{arg};
  str = str + ":done";
  memcpy(buffer, str.c_str(), str.size());
  buffer[str.size()] = 0; // 确保字符串以null结尾
}
